package de.baumann.browser.api.net;


import java.util.List;

import de.baumann.browser.api.net.base.BaseUrl;
import de.baumann.browser.api.net.vo.Order;
import de.baumann.browser.api.net.vo.PayParam;
import de.baumann.browser.api.net.vo.Result;
import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

@BaseUrl(ApiKey.ORDER_MODULE)
public interface OrderApiService {

    @FormUrlEncoded
    @POST(ApiKey.CREATE_ORDER)
    Observable<Result<PayParam>> crateOrder(@Field("order_type") String orderType,
                                            @Field("pay_way") int payWay,
                                            @Field("count") int count,
                                            @Field("price") String price,
                                            @Field("amount") String amount,
                                            @Field("id") String id,
                                            @Field("tradeNo") String tradeNo,
                                            @Field("shopName") String shopName,
                                            @Field("notifyUrl") String notifyUrl);

    @FormUrlEncoded
    @POST(ApiKey.CONFIRM_PAY)
    Observable<Result<PayParam>> odinPay(@Field("trade_no") String tradeNo,
                                         @Field("password") String password);

    @FormUrlEncoded
    @POST(ApiKey.CANCEL_ORDER)
    Observable<Result> cancelOrder(@Field("trade_no") String tradeNo);

    @FormUrlEncoded
    @POST(ApiKey.GET_ORDERS)
    Observable<Result<List<Order>>> getOrders(@Field("type") int type,
                                              @Field("status") int status,
                                              @Field("page_num") int pageNum,
                                              @Field("page_size") int pageSize);

}
